package hu.szyrt.bug.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class Settings {

	
	public final static String KEY_USER_ID = "user_id",
							   KEY_DB_VERSION = "db_version";
	
	private SharedPreferences settings;
	
	public Settings(Context context) {
		this.settings = PreferenceManager.getDefaultSharedPreferences(context);
	}
	
	// save & load ------------------------------
	public void save(String key, Object o){
		settings.edit().putString(key, Base64.encodeToString(String.valueOf(o).getBytes(), false)).commit();
	}
	
	public Object load(String key){		
		return new String(Base64.decode(settings.getString(key, null)));
	}
	
}
